package com.sixmac.controller;

import com.sixmac.common.base.BaseController;
import com.sixmac.core.toolbox.ajax.AjaxResult;
import com.sixmac.pojo.Banner;
import com.sixmac.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * BannerController
 * 2018-10-16 16:43:38
 *
 * @author Blade
 */
@Controller
@RequestMapping("/api/banner")
public class BannerController extends BaseController {

    @Autowired
    BannerService service;

    /**
     * @api {post} /api/banner/banner    Banner显示
     * @apiName banner.banner
     * @apiGroup banner
     * @apiSuccess {String}     cover    广告图片
     * @apiSuccess {String}     createDate    创建时间
     * @apiSuccess {String}     updateDate    更新时间
     * @apiSuccess {String}     url    链接地址
     * @apiError {Integer} 1
     */
    @RequestMapping("/banner")
    @ResponseBody
    public AjaxResult AllBanner() {
        List<Banner> banners = service.findAll();
        return json(getData("list", banners));
    }


}
